#!/bin/bash
clear
echo "Compiling library..."
echo ""
qmake graafalgoritmes_lib.pro
no=`echo $?`
if [ $no -ne 0 ]; then
	exit 1;
fi
make
no=`echo $?`
if [ $no -ne 0 ]; then
	exit 1;
fi
echo ""
echo "Installing library..."
echo ""
sudo make install
no=`echo $?`
if [ $no -ne 0 ]; then
	exit 1;
fi
echo ""
echo "Compiling application..."
echo ""
qmake graafalgoritmes_app.pro
no=`echo $?`
if [ $no -ne 0 ]; then
	exit 1;
fi
make
echo ""
echo "Compiling plugins..."
echo ""
cd plugins
no=`echo $?`
if [ $no -ne 0 ]; then
	exit 1;
fi

# Compiling plugins...
for file in ./*.pro
do
	qmake $file
	no=`echo $?`
	if [ $no -ne 0 ]; then
		exit 1;
	fi
	make
	no=`echo $?`
	if [ $no -ne 0 ]; then
		exit 1;
	fi
	make clean
done

# Done compiling plugins

cd ..
no=`echo $?`
if [ $no -ne 0 ]; then
	exit 1;
fi
echo ""
echo "Done."
echo ""
echo "Testing presence of DOT tool..."
dot -V
no=`echo $?`
if [ $no -ne 0 ]; then
	echo "Warning. The DOT tool is not installed!!"
fi
